import pickle


class PickleReader:
    def __init__(self, file):
        """
        :param file: pkl file path.
        """
        self.file = open(file, "rb")

    def read(self):
        return pickle.load(self.file)

    def __del__(self):
        self.file.close()


class PickleWriter:
    def __init__(self, file: str):
        self.file = open(file, "wb+")

    def save(self):
        return pickle.load(self.file)

    def __del__(self):
        self.file.close()
